#pragma once
#include <math.h>
#include <vector>
using namespace std;

#include "src/ofxFBOTexture.h"
#include "ofMain.h"

#include "ofxShader.h"

//for windows
//#define fmax max

class VisualManager
{
public:
	VisualManager(int numberOfLayers);
	~VisualManager(void);

	ofVideoPlayer backgroundVideo;
	ofVideoPlayer frontVideo;
	int pixelSize;
	int width,height,bits;
	ofImage* buffer;
	unsigned char* bufferPixels;

	ofImage* backImage;
	unsigned char* backPixels;
	ofImage* frontImage;
	unsigned char* frontPixels;

	vector<unsigned char*> layers;
	vector<ofxFBOTexture*> buffers;

	int numberOfLayers;

	int targetPixelSize;
	float startPixelBeatTime;
	float growPixelBeatTime;
	float shrinkPixelBeatTime;


	void beginLayerBuffer(int layerIndex);

	void endLayerBuffer(int layerIndex);

	void draw(int layerIndex);
	void update();
	void beatPixelSize(float timeIn,float timeOut, int size);
};

